#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=2e5+10;
const ll mod=1e9+7;
int a[N];
struct node{
	int x;
	int num;
}b[N];
ll qpow(ll a,ll b,ll p)
{
    ll res=1;
    while(b)
    {
        if(b&1) res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return res;
}
void solve()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int idx=0;
	for(int i=0;i<n;i++)
	{
		int j=i+1;
		while(j<n && a[j]==a[i]) j++;
		j--;
		b[idx].x=a[i];
		b[idx++].num=j-i+1;
		i=j;
	}
	ll cnt=1;
//	cout<<idx<<endl;
    queue<int> q;
    ll ans=0;
	for(int i=0;i<idx;i++)
	{
		if(q.size()<=m)
		{
			while(q.size())
			{
				int idx1=q.front();
				if(b[i].x-m<b[idx1].x) break;
				else
				{
					q.pop();
					cnt=cnt*qpow(b[idx1].num,mod-2,mod)%mod;
				}
			}
			q.push(i);
			cnt=cnt*b[i].num%mod;
		}
//		cout<<q.size()<<'\n';
		if(q.size()==m)
		{
			ans=(ans+cnt)%mod;
		}
	}
	cout<<ans<<endl;
}
int main()
{
	IOS;
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}

	return 0;
}

